/**
 * 
 */
package org.mhz.sit.entity;

import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;

import javax.persistence.Column;
import javax.persistence.MappedSuperclass;

import org.mhz.sit.util.Constants;

/**
 * @author Mahan
 *
 * Base speaker
 */
@MappedSuperclass
public class BaseSpeaker
{
    @Column(name = "name")
    private String mName;    

    /**
     * Constructor
     */
    public BaseSpeaker()
    {
        super();
    }
    
    /**
     * @param aName - The speaker name
     */
    public BaseSpeaker(final String aName)
    {
        super();
        mName = aName;
    }

    /**
     * @return Returns the name.
     */
    public String getName()
    {
        return mName;
    }

    /**
     * @param aName The name to set.
     */
    public void setName(final String aName)
    {
        mName = aName;
    }
        
    /**
     * @return The name as a property
     */
    public StringProperty nameProperty() 
    { 
        if (mName == null)
        {
            final StringProperty name = new SimpleStringProperty(this, Constants.SPEAKER_NAME_PROP);
            return name;
        }
        
        return new SimpleStringProperty(mName);
    }

    /* (non-Javadoc)
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString()
    {
        return "BaseSpeaker [Name=" + mName + "]";
    }
}
